<template>
  <div class="purchase" style="padding-top: 16px">
    <div class="purchase_top">
      <div style="font-size: 20px">BTC/USDT</div>
      <span
        style="
          font-size: 16px;
          color: #909090;
          position: absolute;
          right: 3%;
          top: -3px;
        "
        @click="remove"
        >✕</span
      >
    </div>
    <div class="purchase_fu" style="margin-top: 20px">
      <span style="color: #929292; font-size: 13px">成本价</span>
      <span style="color: #fff; font-size: 14px">68,407.6</span>
    </div>
    <div class="purchase_fu">
      <span style="color: #929292; font-size: 13px">成本价</span>
      <span style="color: #fff; font-size: 14px">68,407.6</span>
    </div>
    <div class="purchase_but">
      <div
        @click="index = 1"
        :class="index == 1 ? 'purchase_but_right' : 'purchase_but_left'"
      >
        买入
      </div>
      <div
        @click="index = 0"
        :class="index == 0 ? 'purchase_but_right' : 'purchase_but_left'"
      >
        卖出
      </div>
    </div>
    <div class="purchase_jge">
      <div class="purchase_jge_left">
        <span style="color: #bdbdbd; font-size: 13px; margin-left: 8px"
          >价格（usdt）</span
        >
        <span style="color: #fff; font-size: 13px; margin-left: 8px"
          >67,219.9</span
        >
      </div>
      <div class="purchase_jge_rig">
        <span
          style="
            color: #fff;
            font-size: 13px;
            margin-left: 4px;
            margin-right: 4px;
          "
          >市价</span
        >
      </div>
    </div>
    <div class="purchase_two">
      <div class="purchase_two_left">
        <span style="margin-left: 8px">数量</span>
        <span style="margin-right: 8px">BTC</span>
      </div>
      <div class="purchase_two_left">
        <span style="margin-left: 8px">金额</span>
        <span style="margin-right: 8px">USDT</span>
      </div>
    </div>
    <div style="margin-top: 10px; margin-left: 2.5%">
      <div class="slider-container">
        <vue-slider
          v-model="percentageVal"
          :marks="{
            0: '',
            25: percentageVal == 25 ? '25%' : '',
            50: percentageVal == 50 ? '50%' : '',
            75: percentageVal == 75 ? '75%' : '',
            100: percentageVal == 100 ? '100%' : '',
          }"
          :included="true"
          :step="25"
          :min="0"
          :max="100"
          :process-style="{ backgroundColor: '#fff', height: '4px' }"
          :rail-style="{ backgroundColor: '#191919', height: '4px' }"
        >
          <template v-slot:step="{ active }">
            <div :class="['custom-step', { active }]"></div>
          </template>
        </vue-slider>
      </div>
    </div>
    <div class="purchase_fu" style="margin-top: 10px">
      <span style="color: #929292; font-size: 13px">可用</span>
      <span style="color: #fff; font-size: 14px">0.00002078 BTC</span>
    </div>
    <div class="purchase_fu">
      <span style="color: #929292; font-size: 13px">可用</span>
      <span style="color: #fff; font-size: 14px">10.00002078 BTC</span>
    </div>
    <div class="purchase_fu_but">卖出BTC</div>
  </div>
</template>

<script>
import { Checkbox, CheckboxGroup } from "vant";
import VueSlider from "vue-slider-component";
import "vue-slider-component/theme/default.css";
export default {
  name: "purchase",
  components: {
    [Checkbox.name]: Checkbox,
    [CheckboxGroup.name]: CheckboxGroup,
    VueSlider,
  },
  data() {
    return {
      checkedo: false,
      index: 1,
      value: "",
      percentageVal: "",
    };
  },
  methods: {
    remove() {
      console.log(233234);

      this.$emit("palyShowRemove", false);
    },
  },
};
</script>
<style scoped lang="scss">
select {
  appearance: none;
  /* 去掉默认图标 */
  -moz-appearance: none;
  /* Firefox */
  -webkit-appearance: none;
  /* Safari and Chrome */
  padding: 0 20px 0 20px;
  background: url("../../assets/image/public/grey-select.png") no-repeat scroll
    right center transparent;
  /* 自己的图*/
  background-size: 20px 11px;
}

.with100 {
  width: 100%;
}

.height100 {
  height: 100%;
}

.targetPrice {
  opacity: 1;
}

.inputBackground {
  border-radius: 10px;

  input {
    background: transparent !important;
  }
}

.custom-step {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  // border: solid 1px #fff;
  background: #212121;
  transform: translateY(-6px);
}

.custom-step.active {
  box-shadow: 0 0 0 2px #fff;
  background-color: #000000;
  transform: translate(-5px, -6px);
}

.tab-item {
  display: flex;
  align-items: center;
  justify-content: center;

  @include themify() {
    background: themed("input_background");
  }

  border-radius: 4px;
  margin-right: 10px;
  padding: 10px 0;
}

.total-list {
  @include themify() {
    background: themed("grey_bg");
  }

  display: flex;

  @include themify() {
    color: themed("text_color");
  }

  font-size: 26px;
  align-items: center;
  justify-content: center;
  // margin-bottom: 20px;
  position: relative;

  // ::after {
  //   position: absolute;
  //   content: '';
  //   top: 20%;
  //   left: 50%;
  //   height: 40px;
  //   background: #373737;
  //   width: 1px;

  // }

  .total-div {
    flex: 1;
    text-align: center;
    padding: 20px 0;
    background-color: #191919;
  }
}

.add-icon {
  color: #fff;
  margin-left: 10px;
}

.active-bg {
  @include themify() {
    background: themed("bg_dark");
  }
}

.select-active {
  background: #2ebd85;

  @include themify() {
    color: themed("text_color") !important;
  }
}

.buyandSell {
  position: relative;
  z-index: 9;
  border-radius: 99px;
}

.slider-container {
  padding: 20px 10px;
  margin: 10px 0;
  margin: 0;

  :deep(.vue-slider) {
    height: 4px;

    .vue-slider-mark {
      width: 100%;
      height: 100%;

      .vue-slider-mark-step {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #212121;
        transform: translateY(-8px);
      }

      .vue-slider-mark-label {
        font-size: 24px;
        color: #868d9a;
        margin-top: 16px;
      }
    }

    .vue-slider-dot-handle {
      width: 20px;
      height: 20px;
      border: solid 2px #fff;
      background-color: #000000;
      border-radius: 50%;
      transform: translateY(-8px);
    }

    .custom-step.active {
      box-shadow: 0 0 0 2px #fff;
      background-color: #000000;
    }
  }
}

/deep/ .vue-slider-dot-tooltip-inner {
  display: none;
}

/deep/ .van-slider {
  background-color: #000 !important;
}

/deep/ .van-slider__button {
  background: none !important;
  border: 1px solid rgb(146, 146, 146) !important;
}

.purchase {
  width: 90%;
  margin-left: 5%;
  padding-bottom: 20px;

  .purchase_top {
    display: flex;
    justify-content: space-between;
    font-size: 26px;
    font-weight: bold;
    color: white;
    position: relative;
  }

  .purchase_fu {
    display: flex;
    justify-content: space-between;
  }

  .purchase_but {
    width: 100%;
    // margin-left: 10%;
    height: 3.5rem;
    margin-top: 20px;
    display: flex;
    margin-top: 5%;
    margin-bottom: 5%;

    .purchase_but_left {
      width: 50%;
      height: 100%;
      border-radius: 100px;
      text-align: center;
      line-height: 3.8125rem;
      color: lime;
    }

    .purchase_but_right {
      width: 50%;
      height: 100%;
      border-radius: 100px;
      text-align: center;
      line-height: 3.8125rem;
      color: #eb4b6d;
      background: #383838;
    }
  }

  .purchase_jge {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 18px;

    > div {
      border-radius: 5px;
    }

    .purchase_jge_left {
      display: flex;
      flex-direction: column;
      background: #1a1a1a;
      padding-top: 6px;
      padding-bottom: 6px;
    }

    .purchase_jge_rig {
      line-height: 4.5rem;
      background: #1a1a1a;
      text-align: center;
    }
  }

  .purchase_two {
    display: flex;
    margin-top: 40px;
    justify-content: space-between;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;

    .purchase_two_left {
      height: 76px;
      line-height: 76px;
      border-radius: 5px;
      background: #1a1a1a;
      display: flex;
      justify-content: space-between;
      font-size: 26px;
      color: #bdbdbd;
    }
  }

  .purchase_fu_but {
    height: 5.125rem;
    border-radius: 100px;
    background: #eb4b6d;
    text-align: center;
    line-height: 5.125rem;
    color: #fff;
    font-size: 40px;
    margin-top: 20px;
    margin-bottom: 50px;
  }
}
</style>
